# coding: utf-8

from django.db import models

class Secretaria(models.Model):
	nm_secretaria = models.CharField(max_length=50, blank=False)
	
	def __unicode__(self):
		return self.nm_secretaria 

class Centro_Custo(models.Model):
	secretaria = models.ForeignKey(Secretaria, blank=False)
	nm_centro_custo = models.CharField(max_length=50, blank=False)
	
	def __unicode__(self):
		return self.nm_centro_custo

class Fornecedor(models.Model):
	nm_fornecedor = models.CharField(max_length=100, blank=False)
	cpf_cnpj = models.PositiveIntegerField(max_length=14, blank=False)
	
	def __unicode__(self):
		return self.nm_fornecedor

class Caixa(models.Model):
	nr_caixa = models.PositiveIntegerField(blank=False)
	
	def __unicode__(self):
		return str(self.nr_caixa)

class Processo(models.Model):
	dt_vencimento = models.DateTimeField(blank=True)
	centro_custo = models.ForeignKey(Centro_Custo, blank=False)
	caixa = models.ForeignKey(Caixa, blank=False)
	ano = models.PositiveIntegerField(max_length=4, blank=False)
	nr_processo = models.CharField(max_length=20, blank=False)
	destruido = models.BooleanField(default=False)

	def __unicode__(self):
		return self.nr_processo

class Funcionario(models.Model):
	nm_funcionario = models.CharField(max_length=100, blank=False)
	
	def __unicode__(self):
		return self.nm_funcionario

class Emprestimo(models.Model):
	dt_emprestimo = models.DateTimeField()
	dt_devolucao = models.DateField()
	processo = models.ForeignKey(Processo, blank=False)
	funcionario = models.ForeignKey(Funcionario, blank=False)
	
	def __unicode__(self):
		return str(self.processo)
